package com.zhuiyun.project.api.appLogin.controller;

import com.zhuiyun.project.api.appLogin.service.AppLoginService;
import com.zhuiyun.project.common.response.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName AppLoginController
 * @Description TODO
 * @Author ys
 * @Date 2023/11/14 8:48
 **/
@RestController
@RequestMapping("/Login")
public class AppLoginController {
    @Autowired
    AppLoginService appLoginService;
    /**
     * @param phone
     * @Description 腾讯云发送手机短信
     * @Author HH
     * @Date 2023/4/12 9:43
     * @Return com.zhuiYun.project.common.response.CommonResult
     */
    @GetMapping("/sendPhoneCode")
    public CommonResult sendPhoneCode(String phone) {
        return appLoginService.sendPhoneCode(phone);
    }
    /**
     * @Description 判断手机短信验证码是否正确
     * @Author HH
     * @Date 2023/4/12 13:55
     * @Return com.zhuiYun.project.common.response.CommonResult
     */
    @GetMapping("/verificationCode")
    public CommonResult verificationCode(String phone, String code) {
        return appLoginService.verificationCode(phone, code);
    }
    @GetMapping("/getToken")
    public CommonResult getToken() {
        return appLoginService.getToken();
    }

    @GetMapping("memberLoginByPhone")
    public CommonResult memberLoginByPhone(String phone,String code){
        return appLoginService.memberLoginByPhone(phone,code);
    }
}
